package im.beans;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="t_IM_Group_User")
public class Group_User {
	
	long id;
	Group group;
	User user;
	
	long groupID;
	long userID;
	long ownerID;
	
	// 用户在群中备注
	String realName;
	
	
	// 最后一条消息的时间戳
	long lastReadMsgTimeStamp;
	
	// 创建群组与用户联系的时间
	long createGroupUserTimestamp;
	
	// 群组所属的用户id
	User owner;
	
	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="group_ID")

	public Group getGroup() {
		return group;
	}
	public void setGroup(Group group) {
		this.group = group;
	}
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="user_ID")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public long getLastReadMsgTimeStamp() {
		return lastReadMsgTimeStamp;
	}
	public void setLastReadMsgTimeStamp(long lastReadMsgTimeStamp) {
		this.lastReadMsgTimeStamp = lastReadMsgTimeStamp;
	}
	public String getRealName() {
		return realName;
	}
	public void setRealName(String realName) {
		this.realName = realName;
	}
	public long getCreateGroupUserTimestamp() {
		return createGroupUserTimestamp;
	}
	public void setCreateGroupUserTimestamp(long createGroupUserTimestamp) {
		this.createGroupUserTimestamp = createGroupUserTimestamp;
	}
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="owner_ID")
	public User getOwner() {
		return owner;
	}
	public void setOwner(User owner) {
		this.owner = owner;
	}
	
	
	@Column(name="owner_ID",insertable=false,updatable=false)
	public long getOwnerID() {
		return ownerID;
	}
	public void setOwnerID(long ownerID) {
		this.ownerID = ownerID;
	}
	@Column(name="group_ID",insertable=false,updatable=false)
	public long getGroupID() {
		return groupID;
	}
	public void setGroupID(long groupID) {
		this.groupID = groupID;
	}
	
	@Column(name="user_ID",insertable=false,updatable=false)
	public long getUserID() {
		return userID;
	}
	public void setUserID(long userID) {
		this.userID = userID;
	}
	
	

}
